package net.towee.client.com.app.view;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.inject.Inject;

import net.towee.client.com.app.presenter.RememberFormPresenter.Display;
import net.towee.client.com.repo.view.RepositoryTreeNodeView;
import net.towee.client.i18n.ToweeConstants;
import net.towee.client.resources.ClientResource;

public class RememberFormView extends PopupPanel implements Display {
	private final Button yes;

	@Inject
	public RememberFormView(ClientResource resource, ToweeConstants constants) {

		FlowPanel content = new FlowPanel();

		setStyleName(resource.css().repoDocumentExplPopup());
		content.getElement().getStyle().setProperty("textAlign", "center");
		content.getElement().getStyle().setProperty("fontSize", "1.3em");
		setWidget(content);

		content.add(new Label("Запомнить вас?"));

		yes = new Button("Да", new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				hide();
			}
		});
		content.add(yes);

		Button no = new Button("Нет", new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				hide();
			}
		});
		content.add(no);

		yes.setStyleName(resource.css().lobbyNextStepButton());
		no.setStyleName(resource.css().lobbyCloseButton());

		setAutoHideEnabled(true);
		setGlassEnabled(false);
	}
	
	@Override
	public HasClickHandlers getRememberButton() {
		return yes;
	}

	@Override
	public void showForm() {
		show();
		getElement().getStyle().setProperty("left", "50%");
		getElement().getStyle().setProperty("top", "50px");
		getElement().getStyle().setProperty("marginLeft", "-125px");
	}

}
